package com.yxx.controller.admin;

import com.yxx.medicinecommon.result.ResponseResult;
import com.yxx.medicinepojo.vo.BusinessStatisticDataVO;
import com.yxx.medicinepojo.vo.ChineseWesternMedicineOverViewVO;
import com.yxx.medicinepojo.vo.OrderOverViewWorkSpaceVO;
import com.yxx.medicinepojo.vo.SetmedicineOverViewVO;
import com.yxx.service.WorkSpaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.core.Local;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.Response;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @author yuxiangxun
 * @date 2024/9/18
 * @apiNote
 */
@Slf4j
@Api(tags = "工作台")
@RestController
@RequestMapping("/admin/workspace")
public class WorkSpaceController {
    @Autowired
    private WorkSpaceService workSpaceService;

    /**
     * 根据今日时间统计数据
     * @return
     */
    @GetMapping("/businessData")
    @ApiOperation("工作台今日数据查询")
    public ResponseResult<BusinessStatisticDataVO> businessStatisticDataVOResponseResult(){
        //获取当天开始时间
        //获取当天结束时间
        BusinessStatisticDataVO businessStatisticDataVO = workSpaceService.getBusinessStatisticData(LocalDateTime.now().with(LocalTime.MIN),LocalDateTime.now().with(LocalTime.MAX));
        return ResponseResult.success(businessStatisticDataVO);
    }

    /**
     * 查询订单管理数据
     * @return
     */
    @GetMapping("/overviewOrders")
    @ApiOperation("查询订单管理数据")
    public ResponseResult<OrderOverViewWorkSpaceVO> orderOverViewWorkSpaceVOResponseResultView(){
        OrderOverViewWorkSpaceVO orderOverViewWorkSpaceVO = workSpaceService.getOrderWorkSpaceVOView();
        return ResponseResult.success(orderOverViewWorkSpaceVO);
    }

    /**
     * 中西药总览
     * @return
     */
    @GetMapping("/overviewDishes")
    @ApiOperation("查询药品总览")
    public ResponseResult<ChineseWesternMedicineOverViewVO> chineseWesternMedicineOverViewVOResponseResult(){
        ChineseWesternMedicineOverViewVO chineseWesternMedicineOverViewVO = workSpaceService.getChineseWesternMedicineOverView();
        return ResponseResult.success(chineseWesternMedicineOverViewVO);
    }

    /**
     * 组合药总览
     * @return
     */
    @GetMapping("/overviewSetmeals")
    @ApiOperation("查询组合药总览")
    public ResponseResult<SetmedicineOverViewVO> setmedicineOverViewVOResponseResult(){
        SetmedicineOverViewVO setmedicineOverViewVO = workSpaceService.getSetMedicineOverView();
        return ResponseResult.success(setmedicineOverViewVO);
    }

}
